package com.cn.keysynchronized;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by chenyuncong on 2019/8/15.
 */
public class SynchronizedMap {
    public static Map<Integer,Integer> map =new HashMap<>();

    public void lock(Integer id){
        if(!map.containsKey(id)){
            map.put(id,id);
        }
        synchronized (map.get(id)){

        }
    }
}
